void main() {
  Person person = Person(name: '张三', age: 20);
  print(person.name);
  print(person.age);

  print('=====================');

  Teacher teacher = Teacher(name: "李四", subject: '数学');
  print(teacher.name);
  print(teacher.subject);
}

class Person {
  String name;
  int? age;

  Person({required this.name, this.age = 18}); // 构造函数
}

class Teacher extends Person {
  String subject;

  Teacher({required this.subject, required super.name, super.age});
}

class Student extends Person {
  String grade;

  Student({required this.grade, required super.name, super.age});
}
